/*
 * Copyright (c) 2009 John Pritchard, WTKX Project Group
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package wtkx;


/**
 *
 * @author jdp
 */
public class Td
    extends Text
{
    protected int colspan;


    public Td(){
        super();
    }


    public void layout(){
        super.layout();
    }
    public int getColspan(){
        return this.colspan;
    }
    public void setColspan(int value){
        this.colspan = value;
    }
    public void setColspan(String value){
        this.setColspan(Integer.parseInt(value));
    }
    public Table getParentTable(){
        Component p = this.parent;
        if (p instanceof Table)
            return (Table)p;
        else {
            do {
                p = p.parent;

                if (p instanceof Table)
                    return (Table)p;
            }
            while (null != p);
            return null;
        }
    }
    public int getRows(){
        Table parent = this.getParentTable();
        if (null != parent)
            return parent.getRows();
        else
            return 0;
    }
    public int getColumns(){
        Table parent = this.getParentTable();
        if (null != parent)
            return parent.getColumns();
        else
            return 0;
    }
    public int getCellspacing(){
        Table p = this.getParentTable();
        if (null == p)
            return 0;
        else
            return p.getCellspacing();
    }
    public int getCellpadding(){
        Table p = this.getParentTable();
        if (null == p)
            return 0;
        else
            return p.getCellpadding();
    }
    protected boolean layoutAutoPosX(){
        return (this.isDisplayable());
    }
    protected boolean layoutAutoPosY(){
        return (this.isDisplayable());
    }
    protected boolean layoutAutoDimW(){
        return (this.isDisplayable());
    }
    protected boolean layoutAutoDimH(){
        return (this.isDisplayable());
    }
}
